<!--
* description: 采购管理-欠拨结案特殊备件设置
* author: hzm
* createdDate: 2021-3-4
-->
<template>
  <div class="app-container app-container-table">
    <one-table-template
      ref="multipleTable"
      :dynamic-buttons="tableButtons"
      :dynamic-components="tableComponents"
      :dynamic-api-config="dynamicApiConfigs"
      :dynamic-table-cols="tableCols"
      :dynamic-form-fields="formField"
      :dynamic-is-show-select="false"
      :dynamic-is-init-table="true"
      :dynamic-is-fix-choose="false"
      :dynamic-is-fix-index="false"
      :dynamic-api-style="'restful'"
    />
  </div>
</template>

<script>
import { formMixins } from "@/components/mixins/formMixins";
import { oneTableWithViewTemplateMixins } from "@/components/mixins/oneTableWithViewTemplateMixins";
import OneTableTemplate from "@/components/templates/oneTable";
import api from "@/api/vehicleManagement";

export default {
  name: "specialPartsClosing",
  components: {
    OneTableTemplate,
  },
  mixins: [oneTableWithViewTemplateMixins, formMixins],
  data() {
    return {
      dynamicApiConfigs: api.inventoryQuery,
      // 动态生成网格列
      tableCols:
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path] &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols
          .length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols
          : [
              {
                prop: "vin",
                label: "备件编码",
                align: "center",
              },
              {
                prop: "moveStateCn",
                label: "备件名称",
                align: "center",
              },
              {
                prop: "isCarState",
                label: "维修类型",
                align: "center",
              },
              {
                prop: "hostLimitrEasonCn",
                label: "适用车型",
                align: "center",
              },
              {
                prop: "assignState",
                label: "结案天数",
                align: "center",
              },
              {
                prop: "hostQualityStateCn",
                label: "备注",
                align: "center",
              }
            ],
      tableComponents:
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path] &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path]
          .tableComponents &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path]
          .tableComponents.length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[this.$route.path]
              .tableComponents
          : [
              // 库存状态
              {
                compKey: "compKey1",
                labelName: "备件编码：",
                codeField: "moveState",
                lookuptype: "VE0212",
                component: () => import("@/components/org/commonInput"),
                type: "inputText",
                isMust: true,
                span: 6,
              },
              // 车辆状态
              {
                compKey: "compKey2",
                labelName: "备件名称：",
                codeField: "isCarState",
                lookuptype: "VE0207",
                component: () => import("@/components/org/commonInput"),
                type: "inputText",
                isMust: true,
                span: 6,
              },
              // 入库仓库
              {
                compKey: "compKey3",
                labelName: "结案天数：",
                codeField: "carStockHouseId",
                component: () => import("@/components/org/commonInput"),
                type: "inputText",
                isMust: true,
                span: 6,
              },
              {
                compKey: "compKey4",
                labelName: "备注：",
                codeField: "assignState",
                component: () => import("@/components/org/commonInput"),
                type: "inputText",
                isMust: true,
                span: 6,
              },
              
            ],
      tableButtons: [
        {
          conmpKey: "btenKey1",
          type: "primary",
          size: "small",
          name: 'search',
          text: "查询",
          clickEvent: () => this.queryTable(1),
          position: "right",
        },
        {
          conmpKey: 'btenKey4',
          type: '',
          size: 'small',
          clickEvent: () => this.export(),
          text: '保存',
        //   name: '保存',
          position: 'right' // 导出
        },
        {
          conmpKey: 'btenKey3',
          type: '',
          size: 'small',
          clickEvent: () => this.export(),
          text: this.$t('sys.button.export'),
          name: 'export',
          position: 'right' // 导出
        },
        {
          conmpKey: "btenKey2",
          type: "",
          size: "small",
          text: "重置",
          name: 'reset',
          clickEvent: () => this.reset(),
          position: "right",
        },
         {
            compKey: 'comKey11',
            type: 'text',
            size: 'small',
            name: '',
            position: 'upload',
            click: (event) => {
              this.export(
                // api.templateDownload.APIUrl,
                '欠拨结案特殊备件定义模板',
                { dataType: 'excel' }
              )
            }
          },
      ],
      formField: this.$utils.getFormField(this, {
        moveState: "",
        isCarState: "",
        carStockHouseId: "",
        assignState: "",
        vin: "",
        lastInStockDate: "",
        hostQualityState: "",
        hostLimitState: "",
      }),
    };
  },
  methods: {
    // 编辑获取数据
    // edit(index) {
    //   this.editPopupsVisible = true
    //   console.log(index,'index');
    //   // this.editRowData = this.$utils.deepCopy(this.$refs['multipleTable'].list[index])
    // }
    // close(aa) {
    //   console.log(aa,'aa');
    // }
  },
  mounted() {
    // this.queryTable(1)
    this.$refs.multipleTable.list = [{
      index: 1
    }]
  },
};
</script>

<style>
</style>
